﻿using System;
using System.Runtime.CompilerServices;

namespace LINQPadLogParser
{
  public sealed class Int32Wrapper : IFormattable
  {
    private readonly string _value;

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public Int32Wrapper(string value)
    {
      _value = value;
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public string ToString(string format, IFormatProvider formatProvider)
    {
      return _value;
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public override string ToString()
    {
      return _value;
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static implicit operator int(Int32Wrapper wrapper)
    {
      return int.Parse(wrapper._value);
    }
  }
}